<template>
  <div class="content" ref="content">
    <div class="table-default">
      <el-button type="primary" class="backBtn" @click="backHandler">返回</el-button>

      <div v-if="tableData">
        <div id="base" ref="base">
          <el-descriptions :column="2" border title="基本信息">
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="暂收单号">{{ tableData.provisional.ordernumber }}</el-descriptions-item>
            <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="备注">{{ tableData.provisional.remarks }}</el-descriptions-item>
            <!-- <el-descriptions-item label-class-name="labelClassNAme" class-name="contentClassName" label="状态">{{ provisionalStatus[tableData.provisional.state] }}</el-descriptions-item> -->
          </el-descriptions>
        </div>

        <div id="details" ref="details" v-loading="loading">
          <el-tabs v-model="activeName" class="demo-tabs">
            <el-tab-pane label="暂收单-内容明细" name="details">
              <contentDetail :id="route.query.id"></contentDetail>
            </el-tab-pane>
            <el-tab-pane label="暂收单-暂收汇总" name="ContentDetails">
              <el-table :data="tableData.dataRes" v-loading="loading" border>
                <el-table-column prop="fseq" label="行号" width="60" />
                <el-table-column prop="fbillno" label="采购单号" min-width="250" />
                <el-table-column prop="fsupplierid_name" label="供应商代号" width="150" />
                <el-table-column prop="supplierOrder" label="供应商送货单单号" width="200" />
                <el-table-column prop="fmaterialid" label="品号" min-width="160" />
                <el-table-column prop="fmaterialname" label="品名" min-width="350" />
                <el-table-column prop="fmaterialmodel" label="规格" min-width="170" />
                <el-table-column prop="funitid_name" label="单位" />
                <el-table-column prop="quantityreceived" label="已暂收的数量" min-width="120" />
                <el-table-column prop="fqty" label="计划数量" min-width="120" />
                <el-table-column prop="repositoryname" label="库位" min-width="150" />
              </el-table>
              <!-- <Paginate /> -->
            </el-tab-pane>
          </el-tabs>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { computed, onMounted, ref, watch } from 'vue'
import { useGetList } from '/admin/composables/curd/useGetList'
import { useDestroy } from '/admin/composables/curd/useDestroy'
import { useOpen } from '/admin/composables/curd/useOpen'
import { useRouter, useRoute } from 'vue-router'
import { ArrowDownBold } from '@element-plus/icons-vue'
import contentDetail from './contentDetail.vue'
import { delDetailRouter } from '/admin/utils/delDetailRouter'

const router = useRouter()
const route = useRoute()
// const id = ref(null)

const api = `purchasing/provisionalreceipt/${route.query.id}`

const { data, query, search, reset, loading } = useGetList(api)
const { destroy, deleted } = useDestroy()
const { open, close, title, visible, id } = useOpen()

const tableData = computed(() => data.value?.data.data)

const backHandler = () => {
  delDetailRouter('暂收单详情', '/purchasing/provisionalreceipt')
}


const activeName = ref('details')
const base = ref(null)
const details = ref(null)
const content = ref()

onMounted(() => {
  search()
  deleted(reset)
})


</script>

<style lang="css">
/* .content{
  border: 2px solid red;
 overflow:hidden;
} */
.backBtn {
  margin: 0 0 10px;
}

h2 {
  font-weight: bold;
}
#base {
  margin-bottom: 30px;
  /* border: 2px solid green; */
}
#details {
  /* border: 2px solid pink; */
}

.tabs {
  padding: 10px 0 0;
  /* border: 2px solid #000; */
  z-index: 999;
  background-color: #fff;
  position: sticky;
  top: -15px;
}

.tagRow {
  display: inline-block;
  /* border: 1px solid #000; */
  margin: 20px 10px;
}

.tagRow ul {
  display: flex;
  border: 1px solid #eee;
}
.tagRow ul li {
  margin: 0 5px;
  /* border: 1px solid #eee; */
  padding: 5px 10px;
  /* border-radius: 5px; */
}
.active {
  background-color: #409eff;
  color: #fff;
}
.labelClassNAme {
  width: 130px;
}
.contentClassName {
  width: 170px;
}
</style>
